#!/bin/sh
#不断抓取美丽说app的cpu时间片段
deviceId=$1
pid=$2

currentDir=$(cd "$(dirname "$0")"; pwd)
echo "current dir : "$currentDir
datDir=$currentDir/../../../target/android-info/battery/dat
htmlDir=$currentDir/../../../target/android-info/battery/html


statFile=${datDir}/cpustat-$pid.dat

if [ -f "$statFile" ]; then
	echo "rm old stat file"
	rm $statFile
fi

while true
do
    adb -s $deviceId shell cat /proc/$pid/stat | awk '{print $14,$15,$16,$17}' >> $statFile
    sleep 3
done
